import json
from flask import Flask
from flask_marshmallow import Marshmallow
from flask_sqlalchemy import SQLAlchemy
# 创建 db 实例
db = SQLAlchemy()
app = Flask(__name__)
ma = Marshmallow(app)

def create_app():
    with open('config.json') as cf:
        config_data = json.load(cf)
    app.config.update(config_data)

    db.init_app(app)
    return app

def create_db():
    with app.app_context():
        from core.blueprints.personal.models import PersonalInformation,PersonalIdentity
        from core.blueprints.auth.models import User
        db.create_all()